/* eslint-disable */
/**
 * Created by GYL on 2018/8/24
 */
import React, { Component } from 'react';
import styles from '../EventPosting.less';
import { Tabs, Icon, Select, Input, Tooltip, Form, Row, Col, TreeSelect, DatePicker, message } from 'antd';
import PublicService from "../../../services/PublicService";
import config from '../../../config';
import Util from '../../../utils/Util';
import request from '../../../utils/request';
import MyTable from "../../../components/common/MyTable";
import MyModal from '../../../components/common/MyModal';
import Small_Tab1 from './smallTab/Small_Tab1';

const TabPane = Tabs.TabPane;
class Edit extends Component {

    constructor(props) {
        super(props)

    }


    componentDidMount() {

        this.setState({
            MyModal1Visible: true
        })
        request({
            url: '/pm-web/projectmanage/subeventsInfo/getSubeventsInfoType',
            method: 'POST',
            data: { subeventsId: this.props.id, userId: PublicService.getCookie('userId') }
        }).then(data => {
            // console.log(data)
            if (data.rc === 0) {
                this.setState({
                    status: data.ret.type
                })
            }
        })
    }





    state = {
        status: true,
        MyModal1Visible: true
    };


    // 取消保存
    ModalCancel = (type) => {
        let t = this;
        t.setState({
            [type]: false,
            modalBtnLoading: false
        })

    };


    //保存按钮事件
    onModalSave = () => {

        this.child.childFunction();
        this.setState({
            MyModal1Visible: false
        })


    }
    onSmall_Tab1 = () => {
        this.props.onModalSave()


    }
    onRef = (ref) => {
        this.child = ref
    }

    click = (e) => {
        this.child.myName()
    }

    render() {
        let t = this
        let width = document.body.clientWidth;
        const height = document.body.clientHeight;
        let containerHeight = '76vh';
        let tableHeight = 310;
        if (width > 1367) {
            tableHeight = 380;
            containerHeight = '83vh';
        }
        const { expandIconPosition, selectedRowKeys } = this.state;
        let { getFieldDecorator } = this.props.form;


        return (

            <MyModal
                mask={false}
                width={800}
                {...this.props}
                title={'事件信息补充'}
                footerShow={this.state.status}
                destroyOnClose={false}
                onModalSave={this.onModalSave}
            >


                <Small_Tab1
                    id={this.props.id}
                    onModalSave={this.onRef}
                    onSmall_Tab1={this.onSmall_Tab1}
                    footerShow={true}
                    flag={this.state.status}
                />

            </MyModal>
        );


    }
}
export default Form.create()(Edit);

